//跳转实时行情
export function stockMarker(code, type, block) {
  console.log(code);
  const setcode = code.match(/(\w)+$/g)[0] == "SZ" ? "0" : "1";
  type = type == undefined ? "" : type;
  if (block) {
    code = code.match(/\d{6}$/)[0];
  } else {
    code = code.match(/\d{6}/)[0];
  }
  window.prompt(
    "",
    `up://["open.stock",${Date.now()},{"setcode":"${
      block ? block : setcode
    }","code":"${code}","type":"${type}"}]`
  );
}
//图片错误重新加载
export function imageHandler(imgPath, e) {
  console.log(imgPath);
  const img = e.srcElement;
  img.src = imgPath;
}

const startTime = Date.now();

export function isOneMinu() {
  const now = Date.now();
  const oneM = 60 * 1000;
  return !(now - startTime < oneM);
}

/**
 * 风口
 */
export function blockStock(data) {
    const { hotspotName, blockCode, stock, articleType } = data;
    window.prompt(
      "",
      `up://["user.info",${Date.now()},{"type":"风口","params":{"articleType":${articleType}},"data":{"hotspotName":"${hotspotName}","blockCode":"${blockCode}","stock":${stock}}}]`
    );
  }
